import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login/index.vue'
import layout from '../views/layout/index.vue'

Vue.use(VueRouter)

const routes = [
    {path:"/",redirect:"/login"},
    {path:"/login",component:login},
  
  // 首页
    {path:"/home",meta:{path:"/home",title:"首页"},component:layout,children:[
      {path:"",meta:{path:"",title:"首页"},component:()=>import("../views/home")}
    ]},
  // 订单
  {path:"/order",meta:{path:"/order",title:"订单管理"},component:layout,children:[
    {path:"",meta:{path:"",title:"订单管理"},redirect:"/order/list"},
    {path:"list",meta:{path:"/order/list",title:"订单列表"},component:()=>import("../views/order/list.vue")},
    {path:"updata",meta:{path:"/order/updata",title:"修改订单"},component:()=>import("../views/order/updata.vue")},
    {path:"detail",meta:{path:"/order/detail",title:"查看订单"},component:()=>import("../views/order/detail.vue")}
  ]},
  //商品
  {path:"/goods",meta:{path:"/goods",title:"商品管理"},component:layout,children:[
    {path:"",redirect:"/goods/list",meta:{path:"",title:"商品管理"}},
    {path:"list",meta:{path:"/goods/list",title:"商品列表"},component:()=>import("../views/goods/list.vue")},
    {path:"save",meta:{path:"/goods/save",title:"添加商品"},component:()=>import("../views/goods/save.vue")},
    {path:"type",meta:{path:"/goods/type",title:"商品分类"},component:()=>import("../views/goods/type.vue")}
  ]},
  
  // 店铺
  {path:"/shop",meta:{path:"/shop",title:"店铺管理"},component:layout,children:[  
    {path:"/",meta:{path:"/",title:"店铺管理"},component:()=>import("../views/shop/index.vue")}
  ]},
  //用户管理
  {path:"/users",component:layout,redirect:"/users/list",meta:{path:"/users",title:"用户管理"},children:[
    {path:"list",meta:{path:"/users/list",title:"用户列表"},component:()=>import("../views/users/list.vue")},
    {path:"personal",meta:{path:"/users/personal",title:"个人中心"},component:()=>import("../views/users/personal.vue")},
    {path:"save",meta:{path:"/users/save",title:"添加账号"},component:()=>import("../views/users/save.vue")},
    {path:"userpwd",meta:{path:"/users/userpwd",title:"修改密码"},component:()=>import("../views/users/userpwd.vue")}
    ]},
    //统计
    {path:"/census",meta:{path:"/census",title:"统计管理"},component:layout,redirect:"/census/goods",children:[
    {path:"goos",meta:{path:"/census/goods",title:"商品统计"},component:()=>import("../views/census/goos.vue")},
    {path:"order",meta:{path:"/census/order",title:"订单统计"},component:()=>import("../views/census/order.vue")}
    ]}
  
  ]

const router = new VueRouter({

    routes
})

export default router